<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script>
  // 原生js发送ajax post请求
  var xhr = new XMLHttpRequest();
  xhr.open("post","/p/json2");
  xhr.setRequestHeader("content-type","application/json");//设置请求头
  xhr.send('{"id":1,"name":"shine","gender":"true"}');//传递json串
</script>
</body>
</html>